import collections
class Solution(object):
    def canConvertString(self, s, t, k):
        if len(s) != len(t):
            return False
        n = len(s)
        now = collections.defaultdict(int)
        for i in range(n):
            if s[i] != t[i]:
                diff = (ord(t[i]) - ord(s[i])) % 26
                if diff + now[diff] * 26 > k:
                    return False
                else:
                    now[diff] += 1

        return True